package com.iot.openfeignblock;

import com.dc3.common.bean.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Set;

/**
 * @Author 咕唧
 * @Date 2022/7/19 17:28
 * @Version 1.0
 */
@FeignClient(value = "iot-cache")
public interface CacheClient {
    @PostMapping("/cache/set")
    R setValue(@RequestParam String key, @RequestParam String value);

    @GetMapping("/cache/value")
    R getValue(@RequestParam String key);


    @PostMapping("/cache/set/seconds")
    R setValueWithExp(@RequestParam("key") String key, @RequestParam("value") String value, @RequestParam("expireTime") Long expireTime);

    @PostMapping("/cache/sadd/{key}")
    R sAdd(@PathVariable String key,  @RequestBody Set<String> values) ;

    @GetMapping("/cache/smember/{key}")
    R sMember(@PathVariable String key);

    @PostMapping("/cache/keys/delete")
    R deleteKeys(@RequestBody Set<String> values);
}
